package com.aipolice.web;

import com.aipolice.pojo.Connews;
import com.aipolice.service.ConnewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class ConnewsController {
    @Autowired
    ConnewsService connewsService;


    @GetMapping("/articles")
    public List<Connews> users(){
        return connewsService.list();

    }

    @GetMapping("/article/{id}")
    public Connews get(@PathVariable("id") int id){
        System.out.println("test!!!!!"+id);
        return connewsService.find(id);
    }



    @DeleteMapping("/article/{id}")
    public void delete(@PathVariable("id") int id){
        System.out.println("删除方法");
        connewsService.delete(id);
    }
}
